import request from '../../utils/request'

/**
 * 分页查询订舱
 *
 */
export async function getListForPage(data) {
    return request(apiPath.mc + "/api/quickBooking", {
        method: 'get',
        data
    });
}



/**
 * 新增订舱
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function createQuickBooking(data) {
    return request(apiPath.mc + "/api/quickBooking", {
        method: 'post',
        data
    });
}


/**
 * 快速订舱更新订舱
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function updateQuickBooking(data) {
    return request(apiPath.mc + "/api/quickBooking", {
        method: 'put',
        data
    });
}


/**
 * 根据id删除订舱
 *
 * @param id
 * @return
 */
export async function deleteById({ id }) {
    return request(apiPath.mc + "/api/quickBooking/" + id, {
        method: 'delete'
    });
}

/**
 * 根据id获取订舱
 *
 * @param id
 * @return
 */
export async function getById({ id }) {
    return request(apiPath.mc + "/api/quickBooking/" + id, {
        method: 'get'
    });
}

/**
 * 根据status获取当前用户的交接单
 *
 * @param status
 * @return
 */
export async function getUserQuickBooking({ status }) {
    return request(apiPath.mc + "/api/user/quickBooking", {
        method: 'get',
        data: { status }
    });
}

/**
 * 分页查询订舱详情
 *
 * @param serviceItems
 * @param salesId
 * @param beginTime
 * @param endTime
 * @param page
 * @param noDraft true 不返回草稿状态的记录
 */
export async function getOpenListForPage (data) {
    return request(apiPath.mc+"/api/open/quickBooking",{
            method: 'get',
            data
        })
}

/**
 * 根据id获取订舱详情
 *
 * @param id
 * @return
 */
export async function getByIdDetail ({id}) {
    return request (apiPath.mc+"/api/quickBooking/detail/"+id,{
        method: 'get',
    })
}

/**
 * 在线订舱更新订舱
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function updateOnlineBooking(data) {
    return request(apiPath.mc + "/api/quickBooking/detail", {
        method: 'put',
        data
    });
}
